package io1;


import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos=new FileOutputStream("yhj.ttx");//文件流
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);//转换流
        BufferedWriter bw=new BufferedWriter(osw);//缓冲流
        PrintWriter pw=new PrintWriter(bw);//字符流
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入内容，单独输入exit时退出");
        while (true){
            String tta=scan .nextLine();
            if("exit".contains(tta)){
                break;
            }
            pw.println(tta);
        }
        pw.close();
    }
}
